<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:dt="http://java.sun.com/jsf/composite/components"
                xmlns:p="http://primefaces.org/ui"
                template="./template1.xhtml">
    
    <ui:define name="mainContent">
        <h2>Draft</h2>
        <ul id="games">
                <li>
                        <h3 class="fancy">Position drafting</h3>
                        <h5 id="position">#{draftBean.activePosition}</h5>
                </li>
                <li>
                    <h3 class="fancy">Team drafting</h3>
                    <h5 id="team">#{draftBean.activeTeam}</h5>
                </li>
                <li>
                        <h3 class="fancy">Players</h3>
                        <form id="players">
                            <h:outputLabel value="Search for player: " />
                            <p:inputText value="#{draftBean.searchPlayer}" id="search" />
                            <p:commandButton value="Search" action="#{draftBean.search}" update="searchResults" /><br/>
                            <h:panelGrid id="searchResults" >
                                <ui:repeat value="#{draftBean.searchResults}" var ="result" >
                                    <h:outputLabel value="#{result}" /><br/>
                                </ui:repeat>
                            </h:panelGrid>
                        </form>
                </li>
                <li>
                    <h3 class="fancy">Current team</h3>
                    <h:panelGrid id="currentTeam">
                        <ui:repeat value="#{draftBean.activeTeamPlayers}" var="teamPlayer" >
                            <h:outputLabel value="#{teamPlayer}" /><br/>
                        </ui:repeat>
                    </h:panelGrid>
                </li>
        </ul>
    </ui:define>
    
    <ui:define name="secondaryContent">
        <h3>Teams</h3>
        <h:panelGrid id="teams" >
            <ui:repeat value="#{leagueBean.teams}" var="team" >
                <p:commandLink update=":teams,:players" >
                    <f:setPropertyActionListener target="#{leagueBean.activeTeam}" value="#{team}" />
                    <h:outputText value="#{team}" /><br/>
                </p:commandLink>
            </ui:repeat>
        </h:panelGrid>
    </ui:define>
    
</ui:composition>
